*******************************
** Feir, Donn, and Rachel L. Wellhausen. 2024. "Replication Data for: Data Sovereignty and Development: How do Native Americans view data sharing by tribal governments? PS: Political Science & Politics. DOI: XXXXXXXXX. **
*Date: 22 August 2024
*Primary contact regarding questions over replication materials: Donn Feir, dfeir@uvic.ca
*******************************
*This file constructs the statistics for the above article, based on the Stata version of the official CMPS data distribution for the 2020 survey (https://cmpsurvey.org/2020-survey/). We have uploaded this do file and the necessary variables from the CMPS master file in order to replicate our study. For full access to CMPS data, please see the CMPS organizers.
*Using Stata/MP 18.0 

*****************************
*Set you File Path Here
*****************************
cd "yourpath"

*****************************
*Install parmby if not already installed
*****************************
ssc install parmest

*************** CLEANING DATA: This cleaning data code is included FYI, to reproduce the data subset we have uploaded beginning from the official CMPS distribution. **************** 
/*
//Loading Data
use "CMPS 2020 full adult sample weighted STATA.dta", clear 


*************** Cleaning Data ****************
//rename state
rename S4 state

gen zipcode = substr(S15,4,6) if substr(S15,1,3)=="X00"
replace zipcode = substr(S15,4,6) if substr(S15,1,3)=="x00"
replace zipcode = substr(S15,3,6) if substr(S15,1,2)=="X0"
replace zipcode = substr(S15,3,6) if substr(S15,1,2)=="x0"
replace zipcode =  substr(S15,2,6) if substr(S15,1,1)=="X"
replace zipcode =  substr(S15,2,6) if substr(S15,1,1)=="x"
destring zipcode, replace

*merging in zipcode data
merge m:1 zipcode using "crosswalksip"
*dropping unrepresented zipcodes
drop if _merge==2
*some don't merge...only one is because of missing zip. Coding it as missing in the crosswalk. Maybe some errors? 
gen missing_zip = (_merge==1)
drop _merge

** Generating key variables - Demographics
drop if nativeam==0

gen statename = "Alaska" if state==1
replace statename = "Alabama" if state==2
replace statename = "Arizona" if state==3
replace statename = "Arkansas" if state==4
replace statename = "California" if state==5
replace statename = "Colorado" if state==6
replace statename = "Connecticut" if state==7
replace statename = "Delaware" if state==8
replace statename = "District of Columbia" if state==9
replace statename = "Florida" if state==10
replace statename = "Georgia" if state==11
replace statename = "Hawaii" if state==12
replace statename = "Idaho" if state==13
replace statename = "Illinois" if state==14
replace statename = "Indiana" if state==15
replace statename = "Iowa" if state==16
replace statename = "Kansas" if state==17
replace statename = "Kentucky" if state==18
replace statename = "Louisiana" if state==19
replace statename = "Maine" if state==20
replace statename = "Maryland" if state==21
replace statename = "Massachusetts" if state==22
replace statename = "Michigan" if state==23
replace statename = "Minnesota" if state==24
replace statename = "Mississippi" if state==25
replace statename = "Missouri" if state==26
replace statename = "Montana" if state==27
replace statename = "Nebraska" if state==28
replace statename = "Nevada" if state==29
replace statename = "New Hampshire" if state==30
replace statename = "New Jersey" if state==31
replace statename = "New Mexico" if state==32
replace statename = "New York" if state==33
replace statename = "North Carolina" if state==34
replace statename = "North Dakota" if state==35
replace statename = "Ohio" if state==36
replace statename = "Oklahoma" if state==37
replace statename = "Oregon" if state==38
replace statename = "Pennsylvania" if state==39
replace statename = "Rhode Island" if state==40
replace statename = "South Carolina" if state==41
replace statename = "South Dakota" if state==42
replace statename = "Tennessee" if state==43
replace statename = "Texas" if state==44
replace statename = "Utah" if state==45
replace statename = "Vermont" if state==46
replace statename = "Virginia" if state==47
replace statename = "Washington" if state==48
replace statename = "West virginia" if state==49
replace statename = "Wisconsin" if state==50
replace statename = "Wyoming" if state==51


gen censusregion = "mountain west" if statename=="Colorado"
replace censusregion = "mountain west" if statename=="Arizona"	 
replace censusregion = "mountain west" if statename=="Idaho"	
replace censusregion = "mountain west" if statename=="New Mexico"	
replace censusregion = "mountain west" if statename=="Montana"	
replace censusregion = "mountain west" if statename=="Utah"	
replace censusregion = "mountain west" if statename=="Nevada" 
replace censusregion = "mountain west" if statename=="Wyoming" 

replace censusregion = "pacific west" if statename=="Alaska" 
replace censusregion = "pacific west" if statename=="California"
replace censusregion = "pacific west" if statename=="Hawaii"	
replace censusregion = "pacific west" if statename=="Oregon"
replace censusregion = "pacific west" if statename=="Washington"	

replace censusregion = "South" if statename=="Delaware"	
replace censusregion = "South" if statename=="District of Columbia"
replace censusregion = "South" if statename=="Florida" 
replace censusregion = "South" if statename=="Georgia"
replace censusregion = "South" if statename=="Maryland" 
replace censusregion = "South" if statename=="North Carolina"
replace censusregion = "South" if statename=="South Carolina"
replace censusregion = "South" if statename=="Virginia"
replace censusregion = "South" if statename=="West Virginia"
replace censusregion = "South" if statename=="Alabama"	
replace censusregion = "South" if statename=="Kentucky"	
replace censusregion = "South" if statename=="Mississippi"	
replace censusregion = "South" if statename=="Tennessee"
replace censusregion = "South" if statename=="Arkansas"	
replace censusregion = "South" if statename=="Louisiana"
replace censusregion = "South" if statename=="Oklahoma"	
replace censusregion = "South" if statename=="Texas"	

replace censusregion = "Midwest" if statename == "Indiana" 
replace censusregion = "Midwest" if statename == "Illinois" 
replace censusregion = "Midwest" if statename == "Michigan"
replace censusregion = "Midwest" if statename == "Ohio"
replace censusregion = "Midwest" if statename == "Wisconsin"
replace censusregion = "Midwest" if statename == "Iowa"
replace censusregion = "Midwest" if statename == "Nebraska"
replace censusregion = "Midwest" if statename == "Kansas" 	
replace censusregion = "Midwest" if statename == "North Dakota"
replace censusregion = "Midwest" if statename == "Minnesota"	
replace censusregion = "Midwest" if statename == "South Dakota"
replace censusregion = "Midwest" if statename == "Missouri"	

replace censusregion = "Northeast" if statename =="Connecticut"	
replace censusregion = "Northeast" if statename =="Maine"
replace censusregion = "Northeast" if statename =="Massachusetts"
replace censusregion = "Northeast" if statename =="New Hampshire" 	
replace censusregion = "Northeast" if statename =="Rhode Island" 	
replace censusregion = "Northeast" if statename =="Vermont" 	
replace censusregion = "Northeast" if statename =="New Jersey"
replace censusregion = "Northeast" if statename =="New York"	
replace censusregion = "Northeast" if statename =="Pennsylvania"	
replace censusregion = "Northeast" if statename =="District of Columbia"


** Female
gen male=0
replace male=1 if S3b==1
label variable male "Male"
label define malelabel 1 "Male" 0 "Female"
label values male femalelabel

** Income
gen inc_30=0 if Q813!=99
replace inc_30=1 if Q813==1 | Q813==2 
label variable inc_30 "Income < $30,000"

gen inc_60=0 if Q813!=99
replace inc_60=1 if Q813>=6 & inc_60!=.
label variable inc_60 "Income > $60,000"

** Age
rename S5_Age age
gen age_1829=0
replace age_1829=1 if age==2
label variable age_1829 "Age 18-29"

** Education
rename S13 education
gen college=0
replace college=1 if  education==4 |  education==5 | education==6 | education==7
label variable college "Attended college"

** Registered voter
gen regvoter=0
replace regvoter=1 if S6==1
label variable regvoter "Registered voter"

** Voter
gen voter=0
replace voter=1 if Q12==1
label variable voter "Voted 2020 (self-report)"

** Votes in tribal elections
gen tribalvoter = 0 
replace tribalvoter =1 if Q266==3 
replace tribalvoter=1 if Q266==2
label variable tribalvoter "Sometimes or always votes in tribal elections"

** Community
*** 265. [N] How often do you attend cultural events, such as powwows, community meals, and ceremonies?
** Attends events
gen events=0 if Q265==1
replace events=1 if Q265>1 & Q265!=.
label variable events "Attends Native events"

*** 271. How important is being [RACIAL GROUP] to your identity?
** Importance to identity
gen identity=0 if Q271==4 | Q271==5
replace identity=1 if Q271==1 | Q271==2 | Q271==3
label variable identity "Native identity important"

*** 819. [N] How well, if at all, do you speak another Native or Tribal language? Do you speak another language…
gen lang=1
replace lang=0 if Q819==4
label variable lang "Speaks Native language"


** Helpfulness of public officials for Native Americans
gen pubofficals=1
replace pubofficals=0 if Q159r1==1
label variable pubofficals "Public officials work hard to help Native Americans at least some of the time"

** Native Americans in government
gen govtparticipation=1
replace govtparticipation=0 if Q159r2==1
label variable govtparticipation "Native Americans have a say in how government handles important issues at least some of the time"


** Natl economic outlook
gen natleconomy=0
replace natleconomy=1 if Q145==1 | Q145==2
label variable natleconomy "Hopeful about national economy"

** Personal economic wellbeing
gen wellbeing=0
replace wellbeing=1 if Q148==1 | Q148==2
label variable wellbeing "Hopeful about personal economic wellbeing"


** Generating value labels
label define opinion 2 "Strongly agree" 1 "Agree" 0 "Neither agree/disagree" -1 "Disagree" -2 "Strongly disagree"
label define opinion_01 1 "Agree" 0 "Neither agree/disagree" -1 "Disagree"

** Questions of interest
/*
[N] American Indian tribes can keep financial data private, or tribes can choose to make data public. To what extent do you think your tribe should share data?

679. [N] My tribal government should NOT share financial data outside the tribe.

680. [N] My tribal government should share financial data outside the tribe IF it means that my family's financial situation would improve.

681. [N] My tribe should share data IF it means that my tribe's economic development would improve.

682. [N] My tribe should share data IF it means that economic development in for all American Indians/Native Americans would improve.

Strongly agree ................................................................... 1

Somewhat agree ............................................................... 2

Neither agree nor disagree............................................... 3

Somewhat disagree .......................................................... 4

Strongly disagree .............................................................. 5
*/

** Purpose - Family
gen share_family=2 if Q679_Q682r2==1
replace share_family=1 if Q679_Q682r2==2
replace share_family=0 if Q679_Q682r2==3
replace share_family=-1 if Q679_Q682r2==4
replace share_family=-2 if Q679_Q682r2==5
label var share_family "Share data if helps family (full)"
label values share_family opinion

** Purpose - Tribe
gen share_tribe=2 if Q679_Q682r3==1
replace share_tribe=1 if Q679_Q682r3==2
replace share_tribe=0 if Q679_Q682r3==3
replace share_tribe=-1 if Q679_Q682r3==4
replace share_tribe=-2 if Q679_Q682r3==5
label var share_tribe "Share data if helps tribe (full)"
label values share_tribe opinion

** Purpose - AmIn
gen share_amin=2 if Q679_Q682r4==1
replace share_amin=1 if Q679_Q682r4==2
replace share_amin=0 if Q679_Q682r4==3
replace share_amin=-1 if Q679_Q682r4==4
replace share_amin=-2 if Q679_Q682r4==5
label var share_amin "Share data if helps American Indians (full)"
label values share_amin opinion

** Respondents that never agree to share?
gen sharefam_never=1 if share_family==0 | share_family==-1 | share_family==-2 
gen sharetribe_never=1 if share_tribe==0 | share_tribe==-1 | share_tribe==-2 
gen shareamin_never=1 if share_amin==0 | share_amin==-1 | share_amin==-2 

gen share_never=0
replace share_never=1 if sharefam_never==1 & sharetribe_never==1 & shareamin_never==1
label var share_never "Respondent never agrees"
drop sharefam_never sharetribe_never shareamin_never

gen share_sometimes = 1-share_never

// Figures for basic descriptives
rename Q679_Q682r1 tribegov_notsharedata
rename Q679_Q682r2 tribegov_shareiffamimprov
rename Q679_Q682r3 tribegov_shareifecondevmytribe
rename Q679_Q682r4 tribegov_shareifecondevallnative

tab tribegov_notsharedata
tab tribegov_shareiffamimprov
tab tribegov_shareifecondevmytribe
tab tribegov_shareifecondevallnative

tab tribegov_notsharedata if nativeam==1
tab tribegov_shareiffamimprov if nativeam==1
tab tribegov_shareifecondevmytribe if nativeam==1
tab tribegov_shareifecondevallnative if nativeam==1

tab tribegov_notsharedata, gen(tg_notsh)
gen tg_notsh_1_2 = (tg_notsh1==1 | tg_notsh2==1)
gen tg_notsh_4_5 = (tg_notsh4==1 | tg_notsh5==1)

tab tribegov_shareiffamimprov, gen(tg_ifi)
gen tg_ifi_1_2 = (tg_ifi1==1 | tg_ifi2==1)
gen tg_ifi_4_5 = (tg_ifi4==1 | tg_ifi5==1)

tab tribegov_shareifecondevmytribe, gen(tg_iedt)
gen tg_iedt_1_2 = (tg_iedt1==1 | tg_iedt2==1)
gen tg_iedt_4_5 = (tg_iedt4==1 | tg_iedt5==1)

tab tribegov_shareifecondevallnative, gen(tg_iedall)
gen tg_iedall_1_2 = (tg_iedall1==1 | tg_iedall2==1)
gen tg_iedall_4_5 = (tg_iedall4==1 | tg_iedall5==1)

*restricting to varaibles used in analysis
keep share_sometimes inc_30 age_1829 male college govtparticipation pubofficals natleconomy wellbeing voter identity lang events tribalvoter tg_* tribegov_notsharedata tribegov_shareiffamimprov tribegov_shareifecondevmytribe tribegov_shareifecondevallnative tribalvoter os_weight

save "Replication_FeirWellhausen_DataSovereigntyandDevelopment_Revised.dta", replace
*/

*************** ANALYSIS ****************
use "Replication_FeirWellhausen_DataSovereigntyandDevelopment_Revised.dta", clear


*********************
******Figure 1*******
*********************
*figure done in excel

preserve

gen one =1

#delimit;
collapse (mean) tg_* tribegov_notsharedata tribegov_shareiffamimprov tribegov_shareifecondevmytribe tribegov_shareifecondevallnative (sd) 

sd_tg_iedall1 =tg_iedall1  sd_tg_iedall2 =tg_iedall2 sd_tg_iedall3 =tg_iedall3 sd_tg_iedall4 =tg_iedall4 sd_tg_iedall5 =tg_iedall5 sd_tg_iedall_1_2 =tg_iedall_1_2 sd_tg_iedall_4_5 =tg_iedall_4_5

sd_tg_iedt1 =tg_iedt1 sd_tg_iedt2 =tg_iedt2 sd_tg_iedt3 =tg_iedt3 sd_tg_iedt4 =tg_iedt4 sd_tg_iedt5 =tg_iedt5 sd_tg_iedt_1_2 =tg_iedt_1_2 sd_tg_iedt_4_5 =tg_iedt_4_5

sd_tg_ifi1 =tg_ifi1  sd_tg_ifi2 =tg_ifi2 sd_tg_ifi3 =tg_ifi3 sd_tg_ifi4 =tg_ifi4 sd_tg_ifi5 =tg_ifi5 sd_tg_ifi_1_2 =tg_ifi_1_2 sd_tg_ifi_4_5 =tg_ifi_4_5

sd_tg_notsh1 =tg_notsh1 sd_tg_notsh2 =tg_notsh2 sd_tg_notsh3 =tg_notsh3 sd_tg_notsh4 =tg_notsh4 sd_tg_notsh5 =tg_notsh5 sd_tg_notsh_1_2 =tg_notsh_1_2 sd_tg_notsh_4_5 =tg_notsh_4_5

sd_notsharedata = tribegov_notsharedata 
sd_shareiffamimprov = tribegov_shareiffamimprov 
sd_shareifecondevmytribe = tribegov_shareifecondevmytribe 
sd_shareifecondevallnative = tribegov_shareifecondevallnative

(rawsum) n = one [aw=os_weight];
#delimit cr

export excel using "Figure1.xls", firstrow(variables) replace

restore

*********************
*****Figure 2********
*********************
*figure done in excel

preserve

gen one =1

#delimit;
collapse (mean) tg_* tribegov_notsharedata tribegov_shareiffamimprov tribegov_shareifecondevmytribe tribegov_shareifecondevallnative (sd) 

sd_tg_iedall1 =tg_iedall1  sd_tg_iedall2 =tg_iedall2 sd_tg_iedall3 =tg_iedall3 sd_tg_iedall4 =tg_iedall4 sd_tg_iedall5 =tg_iedall5 sd_tg_iedall_1_2 =tg_iedall_1_2 sd_tg_iedall_4_5 =tg_iedall_4_5

sd_tg_iedt1 =tg_iedt1 sd_tg_iedt2 =tg_iedt2 sd_tg_iedt3 =tg_iedt3 sd_tg_iedt4 =tg_iedt4 sd_tg_iedt5 =tg_iedt5 sd_tg_iedt_1_2 =tg_iedt_1_2 sd_tg_iedt_4_5 =tg_iedt_4_5

sd_tg_ifi1 =tg_ifi1  sd_tg_ifi2 =tg_ifi2 sd_tg_ifi3 =tg_ifi3 sd_tg_ifi4 =tg_ifi4 sd_tg_ifi5 =tg_ifi5 sd_tg_ifi_1_2 =tg_ifi_1_2 sd_tg_ifi_4_5 =tg_ifi_4_5

sd_tg_notsh1 =tg_notsh1 sd_tg_notsh2 =tg_notsh2 sd_tg_notsh3 =tg_notsh3 sd_tg_notsh4 =tg_notsh4 sd_tg_notsh5 =tg_notsh5 sd_tg_notsh_1_2 =tg_notsh_1_2 sd_tg_notsh_4_5 =tg_notsh_4_5

sd_notsharedata = tribegov_notsharedata 
sd_shareiffamimprov = tribegov_shareiffamimprov 
sd_shareifecondevmytribe = tribegov_shareifecondevmytribe 
sd_shareifecondevallnative = tribegov_shareifecondevallnative

(rawsum) n = one [aw=os_weight], by(tribalvoter);
#delimit cr

export excel using "Figure2.xls", firstrow(variables) replace

restore



*********************
******Figure 3*******
*********************
preserve 

tempfile t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 

parmby "regress share_sometimes inc_30 [aw =os_weight], robust", lab saving(`t1', replace) idn(1)

parmby "regress share_sometimes age_1829 [aw =os_weight], robust", lab saving(`t2', replace) idn(2)

parmby "regress share_sometimes male [aw =os_weight], robust", lab saving(`t3', replace) idn(3)

parmby "regress share_sometimes college [aw =os_weight], robust", lab saving(`t4', replace) idn(4)

parmby "regress share_sometimes govtparticipation [aw =os_weight], robust", lab saving(`t5', replace) idn(5)

parmby "regress share_sometimes pubofficals  [aw =os_weight], robust", lab saving(`t6', replace) idn(6)

parmby "regress share_sometimes natleconomy [aw =os_weight], robust", lab saving(`t7', replace) idn(7)

parmby "regress share_sometimes wellbeing [aw =os_weight], robust", lab saving(`t8', replace) idn(8)

parmby "regress share_sometimes voter [aw =os_weight], robust", lab saving(`t9', replace) idn(9)

parmby "regress share_sometimes identity  [aw =os_weight], robust", lab saving(`t10', replace) idn(10)

parmby "regress share_sometimes lang [aw =os_weight], robust", lab saving(`t11', replace) idn(11)

parmby "regress share_sometimes events  [aw =os_weight], robust", lab saving(`t12', replace) idn(12)

parmby "regress share_sometimes tribalvoter [aw =os_weight], robust", lab saving(`t13', replace) idn(13)

drop _all

use `t1', clear
append using `t2' `t3' `t4' `t5' `t6' `t7' `t8' `t9' `t10' `t11' `t12' `t13' 

drop if parm=="_cons"

#delimit;
label define vals 1	"Income < $30,000"
2	"Age 18-29"
3	"Male"
4	"Attended college"
5	"Native Americans have a say in government" 
6	"Public officials work hard to help Native Americans"
7	"Hopeful about national economy"
8	"Hopeful about personal economic wellbeing"
9	"Voted 2020 US Election"
10	"Native identity important"
11	"Speaks Native language"
12	"Attends Native events"
13	"Sometimes or always votes in tribal elections";
label values idnum vals;


#delimit ;
twoway 	(scatter idnum estimate, sort msymbol(circle) mcolor(black))
		(rcap min95 max95 idnum, sort lcolor(black) horizontal)
		,
		xline(0, lpattern(dash)) ytitle("Coefficient Estimate") xtitle("")
		ylabel(1 2 3 4 5 6 7 8 9 10 11 12 13, valuelabel angle(0)) 
		/*ylabel(-0.3(0.1)0.3)*/ ytitle("")
		legend(off) ;

graph export "Figure3.png", replace ;
#delimit cr

restore
